﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SOM.Security;
using System.Web.Security;


public partial class Controles_uctLogin : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            //Limpa a sessão atual
            Session.Clear();
        }
    }
    protected void txtLogin_Authenticate(object sender, AuthenticateEventArgs e)
    {
        if (SOMSecurity.Autenticar(ctrLogin.UserName, ctrLogin.Password))
        {
            Session["Usuario"] = ctrLogin.UserName;
            FormsAuthentication.RedirectFromLoginPage(ctrLogin.UserName, false);
        }
    }
}
